package com.epfly.promo.activity.feign;

import com.ifood.model.common.base.IFoodResponseEntity;
import com.ifood.model.goods.param.request.food.FoodByIdQuery;
import com.ifood.model.goods.param.response.food.FoodInfo;
import com.ifood.model.merchants.param.MerchantOptions;
import com.ifood.model.merchants.param.request.MerchantQuery;
import com.ifood.model.merchants.param.response.IdentityEmpResp;
import com.ifood.model.merchants.param.response.MerchantInfo;
import com.ifood.model.merchants.param.response.StoreInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

@Service
public class DataRestaurantFeignService {

    @Resource
    private DataRestaurantFeign dataRestaurantFeign;

    public MerchantInfo queryByMerchantId(MerchantOptions merchantOptions) {
        IFoodResponseEntity<MerchantInfo> resp = dataRestaurantFeign.queryByMerchantId(merchantOptions);
        return resp.getData();
    }

    public List<MerchantInfo> queryByMerchantIds(MerchantQuery merchantQuery) {
        return dataRestaurantFeign.queryByMerchantIds(merchantQuery).getData();
    }

    public List<StoreInfo> queryStoreByMerchantId(String merchantId) {
        return dataRestaurantFeign.queryStoreByMerchantId(merchantId).getData();
    }

    public Integer getMealType(String merchantId, String storeId, Long orderTime) {
        return dataRestaurantFeign.getMealType(merchantId, storeId, orderTime).getData();
    }

    public boolean isHoliday(String date) {
        return dataRestaurantFeign.isHoliday(date).getData();
    }

    public IdentityEmpResp getIdentity(String employeeId) {
        return dataRestaurantFeign.getIdentity(employeeId).getData();
    }

    public List<String> getFoodCategoryIdListByFoodIdList(List<String> goodIdList) {
        return dataRestaurantFeign.getFoodCategoryIdListByFoodIdList(goodIdList).getData();
    }

    public List<FoodInfo> findFoodByFoodIdList(Set<String> foodIdList) {

        FoodByIdQuery foodByIdQuery = new FoodByIdQuery();
        foodByIdQuery.setFoodIdList(foodIdList);
        return dataRestaurantFeign.queryBasicByIdList(foodByIdQuery).getData();
    }
}
